﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Management;

namespace FreeboxHDVideoPlayer
{
    public class DriveInfo
    {
        public static DriveInfo Get(string drive)
        {
            drive = drive.Replace("\\", "");
            //create our ManagementObject, passing it the drive letter to the
            //DevideID using WQL
            ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceID=\"" + drive + "\"");
            //bind our management object
            disk.Get();
            //return the free space amount
            DriveInfo di = new DriveInfo();
            di.FreeSpace = long.Parse(disk["FreeSpace"].ToString());
            di.Size = long.Parse(disk["Size"].ToString());
            return di;
        }

        public long Size
        {
            get;
            private set;
        }

        public long FreeSpace
        {
            get;
            private set;
        }
    }
}
